//#define __FORCE_TRACE__
//#define __FORCE_DEBUG__
//#define __FORCE_INFO__
#define THIS_FILE "ia\fn_removeRadio.sqf"
#include <tmf_constants.h>
#include <tmf_macros.h>

TRACE_1("Start",_this);
TMFPROFILERSTART;

private ["_unit"];
DEFAULT_PARAM(_unit,0,objNull);

if (IS_ARRAY(_unit)) then {
	{ [_x] call FFUNC(removeRadio);
	} foreach _unit;
} else {
	if ((IS_OBJECT(_unit) || IS_GROUP(_unit)) && {!isnull _unit}) then {
		if (IS_GROUP(_unit)) then {
			{ [_x] call FFUNC(removeRadio);
			} foreach (units _unit);
		} else {
			{	if (getText(configFile >> "CfgWeapons" >> _x >> "simulation") == "ItemRadio") then {_unit unlinkItem _x};
			} forEach (assignedItems _unit);
		};
	};
};
TRACE("End");
TMFPROFILERSTOP;